package spring.controller;

import org.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;

@Controller
@RequestMapping("/mdm/api/v1/approvals/{deviceId}")
public class GetstatusController {

    @RequestMapping(method = RequestMethod.GET)
    @ResponseBody
    public String getStatus(@PathVariable String deviceId) throws IOException {
        System.out.println("GetstatusController, deviceId= " + deviceId);

        JSONObject json = new JSONObject();
        json.put("result", 0);
        json.put("desc", "ok");
        String detail = "{\"code\": \"2002\",\"desc\": \"detail Ok\"}";
        json.put("detail", detail);

        // return "getStatus Succ";
        return json.toString();
    }
}
